import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Layout from '@/views/Layout'
import Home from '@/views/Second/Home'
import NotFound from '@/views/NotFound'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home/:value/:label',
    children: [
      {
        path: 'home',
        name: 'home',
        component: Home
      },
      {
        path: 'house',
        name: 'house',
        component: () => import('@/views/Second/House')
      },
      {
        path: 'info',
        component: () => import('@/views/Second/Info')
      },
      {
        path: 'my',
        name: 'my',
        component: () => import('@/views/Second/My')
      }
    ]
  },
  {
    path: '/city',
    name: 'city',
    component: () => import('@/views/City')
  },
  {
    path: '/list',
    component: () => import('@/views/List')
  },
  {
    path: '/houseinfo/:housecode',
    component: () => import('@/views/HouseInfo')
  },
  {
    path: '/maphouse',
    component: () => import('@/views/MapHouse')
  },
  {
    path: '/favorite',
    component: () => import('@/views/Second/My/FavoRate')
  },
  {
    path: '/rent',
    component: () => import('@/views/Second/My/Rent')
  },
  {
    path: '/rentadd',
    name: 'add',
    component: () => import('@/views/RentAdd')
  },
  {
    path: '/search',
    name: 'add',
    component: () => import('@/views/RentAdd/Search')
  },
  {
    path: '*',
    component: NotFound
  }
]

const router = new VueRouter({
  routes
})

export default router
